#include<iostream>
using namespace std;
const int N = 6e6;
int a[N];
int main()
{
	int minn = 110;
	int n, p;
	cin >> n >> p;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int k = 0; k < p - 1; k++)
	{
		int x, y, z;
		cin >> x >> y >> z;
		for (int i = x; i <=y; i++)
		{
			a[i] += z;
		}
	}
	int x, y, z;
	cin >> x >> y >> z;
	for (int i = 1; i <= n; i++)
	{
		if(i>=x&&i<=y)
		  a[i] += z;
		minn = min(minn, a[i]);
	}
	cout << minn;
}